package com.twu.biblioteca.menu;

import com.twu.biblioteca.*;

public abstract class ReturnLibraryItemMenuItem extends CheckInOutMenuItem {
    protected ReturnLibraryItemMenuItem(LibraryItemFinder itemFinder) {
        super(itemFinder);
    }

    @Override
    protected boolean performOperation(LibraryItem selectedItem, Library library, User currentUser) {
        return library.checkInItem(selectedItem, currentUser);
    }

    @Override
    protected String getFailureMessage() {
        return "That is not a valid " + getNoun() + " to return. If the " + getNoun() + " is checked out, only the person who checked it out may return it.";
    }

    @Override
    protected String getSuccessMessage() {
        return "Thank you for returning the " + getNoun() + ".";
    }

    @Override
    protected String getPromptMessage() {
        return "Which " + getNoun() + " would you like to return? ";
    }

    protected abstract String getNoun();
}
